package Homework07;

public class Demo extends Test {
    String name = "jack";

    Demo() {
        super();
        System.out.println("Demo");
    }
    Demo(String s){
        super(s);
    }
    public void test(){
        System.out.println(super.name);
        System.out.println(this.name);
    }

    public static void main(String[] args) {
        //创建对象的同时会调用构造器完成对对象的初始化
        new Demo().test();//匿名对象
        //调用的是无参构造器，Test,Demo   ,Rose,jack
        new Demo("john").test();
        //john,jack

    }
}
